import React from 'react';
import './Comment.css';

export default class CommentList extends React.Component {

    renderItem(item) {
        return <div className="commentItem" key={item.id}>
            <div className="comment_author">
                <a className="comment_user" href="/">{item.name}</a>
                <a className="time" href="/">{item.date}</a>
            </div>
            <div className="content">
                {item.content}
            </div>
        </div>
    }

    render() {
        const { commentList } = this.props;
        return (
            <div className="contents">
                {commentList.map(this.renderItem)}
            </div>
        );
    }
}